package com.yw.android.common.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

import com.yw.android.sys.common.R;


public class DialogUtils {
    /**
     * 普通对话框
     */
    public static AlertDialog createCommonDialog(Context mContext, int title, int message,
                                                 DialogInterface.OnClickListener mNegativeOnClickListener, DialogInterface.OnClickListener mPositiveOnClickListener) {
        AlertDialog mCommonDialog = new AlertDialog.Builder(mContext)
                .setTitle(title)
                .setMessage(message).setNegativeButton(R.string.cancel, mNegativeOnClickListener)
                .setPositiveButton(R.string.ok, mPositiveOnClickListener).create();
        mCommonDialog.setCanceledOnTouchOutside(false);
        mCommonDialog.setCancelable(false);
        return mCommonDialog;
    }

    public static AlertDialog createCommonDialog(Context mContext, String title, String message, DialogInterface.OnClickListener mPositiveOnClickListener) {
        AlertDialog mCommonDialog = new AlertDialog.Builder(mContext)
                .setTitle(title)
                .setMessage(message).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .setPositiveButton(R.string.ok, mPositiveOnClickListener).create();
        mCommonDialog.setCanceledOnTouchOutside(false);
        mCommonDialog.setCancelable(false);
        return mCommonDialog;
    }

    public static AlertDialog createCommonDialog(Context mContext, int title, int message, DialogInterface.OnClickListener mPositiveOnClickListener) {
        AlertDialog mCommonDialog = new AlertDialog.Builder(mContext)
                .setTitle(title)
                .setMessage(message).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .setPositiveButton(R.string.ok, mPositiveOnClickListener).create();
        mCommonDialog.setCanceledOnTouchOutside(false);
        mCommonDialog.setCancelable(false);
        return mCommonDialog;
    }
}
